package org.dairy.farms.model;

import org.dairy.farms.interceptor.hibernate.Auditable;

import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;

/**
 * Created by IntelliJ IDEA.
 * User: gduggira
 * Date: Jul 1, 2011
 * Time: 1:58:16 PM
 */
@javax.persistence.Table(name = "LIVESTOCK_STATUS_TYPE")
@Entity
public class LivestockStatusType implements Auditable{
     public enum STATUS {
        ACTIVE,RETIRED,SOLD,EXPIRED,SICK,PREGNANT,NEW_BORN;
    }
    @javax.persistence.Column(name = "ID")
    @Id
    @GeneratedValue
    private Long id;

    @javax.persistence.Column(name = "NAME")
    private String name;

    @javax.persistence.Column(name = "DESCRIPTION")
    private String description;

    @OneToMany(mappedBy = "livestockStatusType",targetEntity = Livestock.class,cascade = CascadeType.ALL,fetch = FetchType.LAZY)
    private Set<Livestock> livestocks = new HashSet<Livestock>();

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Set<Livestock> getLivestocks() {
        return livestocks;
    }

    public void setLivestocks(Set<Livestock> livestocks) {
        this.livestocks = livestocks;
    }
     @Embedded
    private AuditInfo auditInfo = new AuditInfo();
    public AuditInfo getAuditInfo() {
        return auditInfo;
    }

    public void setAuditInfo(AuditInfo auditInfo) {
        this.auditInfo = auditInfo;
    }
}
